import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;

import java.util.Arrays;

public class Main {
    public static int removeDuplicates(int[] nums) {
        int len = nums.length;
        int fast = 1;
        int slow = 1;
        while(fast < len) {
            if(nums[fast] != nums[fast-1]) {
                nums[slow++] = nums[fast];
            }
            fast++;
        }
        return slow;
    }

    public static void main(String[] args) {
        int[] nums = {1,1,2};
        int ret = removeDuplicates(nums);
        System.out.println(ret);
        System.out.println(Arrays.toString(nums));
    }
}